#pragma once

#include <server/gdbIO.h>

#include <QTcpServer>
#include <QTcpSocket>

namespace mopenocd
{

class qtServerIO : public gdbIORemote
{
public:
    qtServerIO();

public:
    virtual int open(const char *dev, long port = 0);
    virtual void close();
    virtual int read(void *buf, uint32_t max, int timeout_ms);
    virtual int write(const void *buf, uint32_t max, int timeout_ms);
    virtual bool nextReadReady();

private:
    QTcpServer _sv;
    QTcpSocket *sk;
};

}
